package com.ymatou.iapi.orderdelivery.testcase;


import com.ymt.core.tool.Logger;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.orderdelivery.parameter.SubscribeExpressInfoBean;
import com.ymatou.iapi.orderdelivery.service.SubscribeExpressInfoCall;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.database.sqlwapper.YmtExpressSubscribeOrderWapper;
import com.ymttest.database.sqlwapper.YmtExpressSubscribeWapper;

@TestSuite
public class Ts_SubscribeExpressInfo {
	
	public static SubscribeExpressInfoCall subcall;
	public static SubscribeExpressInfoBean subbean;
	
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("物流订阅接口");
	}

	@Before
	public void caseUp() {
		subcall = new SubscribeExpressInfoCall();
		subbean = new SubscribeExpressInfoBean();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(subcall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SubscribeExpressInfo_001(){
		
		try {
		Logger.start(true,"一个订单订阅一个物流单号");
		subbean.setBillcode("ceshiyundan");
		subbean.setExpresscode("shunfeng");
		subbean.setExpressfrom("");
		subbean.setExpressto("天津市天津市南开区234123dsfasdf");
		subbean.setInnerExpressCode("Y073");
		subbean.setOrderid(123321123);
		subbean.setSubsource(1);
		subcall.setData(subbean);
		subcall.callService();		
		
		YmtExpressSubscribeWapper test = new YmtExpressSubscribeWapper();
		YmtExpressSubscribeOrderWapper test2 = new YmtExpressSubscribeOrderWapper();
		
		String actulExpresscode = test.selectByBillcode(subbean.getBillcode()).getExpresscode();
		Integer actulOrderid = test2.selectByOrderid(subbean.getOrderid()).getOrderid();
		
	    Logger.comment("开始验证订阅详情表落地物流公司编码是否一致");
		Logger.verifyEquals(subbean.getExpresscode(), actulExpresscode, "验证落地物流公司编码是否一致");
		Logger.comment("开始验证订阅详情表落地发货运单是否一致");
		Logger.verifyEquals("ceshiyundan", subbean.getBillcode(), "验证落地物流公司编码是否一致");
		Logger.comment("开始验证订阅详情表和订阅记录表落地订单号是否一致");
		Logger.verifyEquals(subbean.getOrderid(), actulOrderid, "验证详情表和订单表记录是否一致");
		
		
		
		
		
		}
		catch(Exception e){
			Logger.fail(e);
		}
	}


}
